package cn.bdqn.pro.controller;

import cn.bdqn.model.PageBean;
import cn.bdqn.pro.model.Project;
import cn.bdqn.pro.service.ProjectService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author gurilla
 * @create 2019-08-23 14:58
 */
@Controller
@RequestMapping("/pro/project")
public class ProjectController {
    //调用
    @Resource
    private ProjectService projectService;

    @RequiresPermissions("pro:project:page")
    @GetMapping
    public String topage(){
        return "/pro/project";
    }

    @RequiresPermissions("pro:project:list")
    @PostMapping("list")
    @ResponseBody
    public Object list(PageBean pageBean, String pname){
        return projectService.list(pageBean, pname);
    }

    @RequiresPermissions("pro:project:save")
    @PostMapping("save")
    @ResponseBody
    public Object save(Project project){
        return projectService.save(project);
    }

}

